import request from '@/utils/request'

export function page(query) {
    return request({
        url: '/clazz',
        method: 'get',
        params: query
    })
}

export function add(clazz) {
    return request({
        url: '/clazz',
        method: 'post',
        data: clazz
    })
}

export function update(clazz) {
    return request({
        url: '/clazz',
        method: 'put',
        data: clazz
    })
}

export function deleteById(id) {
    return request({
        url: '/clazz/' + id,
        method: 'delete'
    })
}

export function selectById(id) {
    return request({
        url: '/clazz/' + id,
        method: 'get'
    })
}

// 导入Excel文件
export function importExcel(formData) {
  return request({
    url: '/clazz/import',
    method: 'post',
    data: formData,
    headers: { 'Content-Type': 'multipart/form-data' }
  })
}

export function exportExcel() {
  const config = {
    url: '/clazz/export',
    method: 'get',
    responseType: 'blob' // 设置响应类型为blob，处理二进制数据
  };
  return request(config);
}

